package com.example.demo.oo.controller;

import com.example.demo.app.Response;
import com.example.demo.oo.domain.Captcha;
import com.example.demo.oo.service.CaptchaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("captcha")
public class CaptchaController extends BaseController {

    @Autowired
    CaptchaService captchaService;

    @PostMapping("send")
    public Response send(Captcha captcha) {

        /* 参数验证 只验证手机号 */
        captcha.getMobile().valid();

        captchaService.send(captcha);

        return success(captcha);

        //return success();
    }
}
